
#include <oglRenderer/oglRenderer.h>
#include <oglRenderer/pixelformat.h>
#include <gl/wglew.h>



BEGIN_NAMESPACE_OXGE


//////////////////////////////////////////////////////////////////////////
class Win32oglContext : public oxgeClass<Win32oglContext>, public oglContext
{
public:
	Win32oglContext(HDC hdc, HGLRC hglrc){
		m_hDC = hdc;
		m_hRC = hglrc;	
	}

	~Win32oglContext()
	{	
		wglMakeCurrent(NULL,NULL);
		wglDeleteContext(m_hRC);
	}

	virtual void makeCurrent()
	{ 
		wglMakeCurrent(m_hDC,m_hRC);
	}

	virtual void shareDislayList(oglContext* pOtherContex)
	{
		Win32oglContext* pWin32Contex = dynamic_cast<Win32oglContext*>(pOtherContex);
		if(pWin32Contex)
		{
			wglShareLists(m_hRC,pWin32Contex->m_hRC);
			oglContext::shareDislayList(pOtherContex);
		}		
	}

protected:

	HGLRC m_hRC;
	HDC m_hDC;
};

//////////////////////////////////////////////////////////////////////////
class Win32oglRenderer : public oglRenderer
{
public:


	void Initialize(HDC hdc, int pixelFormat);

	void StartRender();
	void EndRender();
	

protected:	
	
};




END_NAMESPACE_OXGE